package ch07;

class _20_FighterTest {
	public static void main(String[] args) {
		Fighter f = new Fighter();

		if (f instanceof Unit)
			System.out.println("f extends Unit.");

		if (f instanceof Fightable) 
			System.out.println("f implements Fightable.");

		if (f instanceof Movable) 
			System.out.println("f implements Movable.");

		if (f instanceof Attackable) 
			System.out.println("f implements Attackable.");

		if (f instanceof Object)
			System.out.println("f extends Object.");
	}
}

class Fighter extends Unit implements Fightable {
	public void move(int x, int y) { }

	public void attack(Unit u) { }
}

class Unit {
	int currentHP;
	int x;
	int y;
}

interface Fightable extends Movable, Attackable { }

interface Movable {
	void move(int x, int y);
}

interface Attackable {
	void attack(Unit u);
}
/*
f extends Unit.
f implements Fightable.
f implements Movable.
f implements Attackable.
f extends Object.
*/